%%%-------------------------------------------------------------------
%% @doc dc_test1 public API
%% @end
%%%-------------------------------------------------------------------

-module(dc_test1).
-behaviour(cache_worker).

-include_lib("eunit/include/eunit.hrl").

-export([start/0]).
-export([load/1, save/1, delete/1, db_load/1, db_save/1, db_delete/1]).

start() ->
    Args = [ {module, ?MODULE}
           , {save_time, 0}
           ],
    cache_sup:start_child_worker(?MODULE, Args).

load(Key) ->
    cache_worker:load(?MODULE, Key).

save(Data) ->
    Key = element(1, Data),
    cache_worker:save(?MODULE, Key, Data).

delete(Key) ->
    cache_worker:delete(?MODULE, Key).

db_load(Key) ->
    {Key, 1,2,3,4,5}.

db_save(Data) ->
    timer:sleep(10000),
    ?debugFmt("dc_test1 db_save Data: ~p", [Data]),
    ok.

db_delete(Key) ->
    {Key, 1,2,3,4,5}.

%% internal functions
